@(id: Long, EmployeeForm: Form[Employee], entities:List[LegalEntity])

@import helper._ 

@implicitFieldConstructor = @{ FieldConstructor(twitterBootstrapInput.render) } 

@main {
    
    <h1>Edit Employee</h1>
 
   
    @form(routes.EmployeeCRUD.update(id)) {
       
        <fieldset>
         @inputText(EmployeeForm("firstname"), '_label -> "Nombre")   
		 @inputText(EmployeeForm("lastname"), '_label -> "Apellido")
		 
		  
 		@select(
                EmployeeForm("documentType"), 
                options = options(DocumentTypes.list),
                '_default -> "--- Seleccione tipo de documento ---",
                '_label -> "Tipo de documento",
                '_error -> EmployeeForm("documentType").error.map(_.withMessage("Seleccione tipo de documento"))
        )
            
 
 		@inputText(EmployeeForm("document"), '_label -> "documento") 
 		@inputText(EmployeeForm("CUIL"), '_label -> "CUIL") 


		@inputText(EmployeeForm("birthday"), '_label -> "Fecha de Nacimiento") 

 
		@select(
		        EmployeeForm("legalEntity.id"),
		        entities.map{ c =>  c.id.toString -> c.name
		    },
		    '_label -> "Entidad"
		)
       	   
           
       

        </fieldset>	
        
        <div class="actions">
            <input type="submit" value="Save this Employee" class="btn primary"> or 
            <a href="@routes.EmployeeCRUD.list()" class="btn">Cancel</a> 
        </div>
        
    }
    
    @form(routes.EmployeeCRUD.delete(id), 'class -> "topRight") {
        <input type="submit" value="Delete this Employee" class="btn danger">
    }
    
}
